package com.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dk.entity.DtBrand;
import com.dk.mapper.DtBrandMapper;
import com.dk.service.IDtBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 * 品牌表 服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtBrandServiceImpl  implements IDtBrandService {
    @Autowired
    private DtBrandMapper dtBrandMapper;

    @Override
    public IPage<DtBrand> selectPage(Integer pageNum, Integer pageSize) {

        Page<DtBrand> page = new Page<>(pageNum, pageSize );
        IPage<DtBrand> dtBrandIPage = dtBrandMapper.selectPage(page, null);
        return dtBrandIPage;
    }

    @Override
    public void addBrand(DtBrand dtBrand) {
        dtBrandMapper.insert(dtBrand);
    }

    @Override
    public DtBrand selectById(Long id) {
        return dtBrandMapper.selectById(id);
    }

    @Override
    public void update(DtBrand dtBrand) {
        dtBrandMapper.updateById(dtBrand);
    }

    @Override
    public void deleteBrandById(Long id) {
        dtBrandMapper.deleteById(id);
    }
}
